package com.作业.Day16;

import java.io.*;

public class Test3 {
    public static void main(String[] args) {
        /**
         * 转换流
         */
        try(  InputStreamReader ip = new InputStreamReader(new FileInputStream("helloword.txt"),"GBK");
              OutputStreamWriter outputStreamWriter = new OutputStreamWriter(new FileOutputStream("java.text"))) {
            char[] chars = new char[2];
              int len=0;
            while ((len = ip.read(chars)) != -1) {
              outputStreamWriter.write(chars,0,len);
            }


        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
